#ifndef __TCP_CLIENT_TEST__
#define __TCP_CLIENT_TEST__

#include <iostream>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#include <string.h>

#define SEVERPORT 8997
#define MESSAGE_SIZE 1024

namespace sdx {
class TcpClient {
public:
  TcpClient();
  ~TcpClient();

private:
  int socketFd = -1;
  int ret = -1;
  struct sockaddr_in serverAddr;
  char sendBuff[MESSAGE_SIZE] = {0};
  char recvBuff[MESSAGE_SIZE] = {0};

public:
  void createSocket();
  void setserverAddr();
  void connect2server();
  int sendMessage();
  void recvMessage();
  void closeSocket();
};
} // namespace sdx
#endif